package com.myspring.aop.eg.annoaop;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestAop {

    @Test
    public void testNoXml()
    {
        ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
        Calculator calculator = (Calculator) context.getBean("calculator", Calculator.class);
        calculator.add(1, 2);
    }


    @Test
    public void testAdd(){
        ApplicationContext context =
                new ClassPathXmlApplicationContext("bean.xml");

        Calculator cal = (Calculator) context.getBean(Calculator.class);
        cal.add(10, 20);
    }
}
